#include <QDebug>
#include <QString>
#include "log.h"

/********************************
  Log Levels

  0: fatal
  1: critical
  2: error
  3: warning
  4: informational
  5: debugging

********************************/

LogMonitor::LogMonitor(QObject *parent) :
    QObject(parent)
{
    qDebug() << "LogMonitor::LogMonitor()";
    logLevel = 5;
}

void LogMonitor::setLogLevel(int level)
{
    logLevel = level;
}

void LogMonitor::logFromClient(int level, QString msg)
{
    if (level <= logLevel)
        qDebug() << "[Client] " << msg;
}

void LogMonitor::logFromConnection(int level, QString msg)
{
    if (level <= logLevel)
        qDebug() << "[Conn] " << msg;
}

void LogMonitor::logFromLineShare(int level, QString msg)
{
    if (level <= logLevel)
        qDebug() << "[LineShare] " << msg;
}

void LogMonitor::logFromPeerManager(int level, QString msg)
{
    if (level <= logLevel)
        qDebug() << "[PeerMgr] " << msg;
}

void LogMonitor::logFromServer(int level, QString msg)
{
    if (level <= logLevel)
        qDebug() << "[Server] " << msg;
}
void LogMonitor::logFromStroke(int level, QString msg)
{
    if (level <= logLevel)
        qDebug() << "[Stroke] " << msg;
}
